home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16752 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.1 KB  |  54 lines

  1. Path: news.mira.net.au!usenet
  2. From: tsi@werple.mira.net.au (Paul Thomson)
  3. Newsgroups: comp.lang.c++
  4. Subject: BC5.0 and Templates
  5. Date: 12 Apr 1996 08:05:57 GMT
  6. Organization: Thomson Scientific Instruments
  7. Message-ID: <4kl2t5$cp@eplet.mira.net.au>
  8. NNTP-Posting-Host: dp-m-b41.werple.net.au
  9. Mime-Version: 1.0
  10. X-Newsreader: WinVN 0.93.14
  11.  
  12. I am in the unfortunate position at the moment of having to work on some elses code.  I am having 
  13. difficulty getting some code which compiles fine on BC4.53 to compile using BC5.0.  The problem 
  14. concerns templates with which I am not very familair.  The following code is not functional but 
  15. does compile using BC4.53:
  16.  
  17. FOOTEST.H
  18.  
  19. #ifndef Foo_H
  20. #define Foo_H
  21.  
  22. template<class T> class foo {
  23.   public:
  24.   foo(int size = 0);
  25. };
  26.  
  27. #endif
  28.  
  29. FOOTEST.CPP
  30.  
  31. #include "footest.h"
  32.  
  33. foo<double>::foo(int sz) {
  34. }
  35.  
  36. template<class T> foo<T>::foo(int size) {
  37. }
  38.  
  39. BC5.0 complains that "Body has already been defined for function 'foo<double>::foo<int>'
  40.  
  41. Is this legal C++?  Was there a bug in BC4.53 which allowed this or does BC5.0 indeed have a bug 
  42. in this area?
  43.  
  44.  
  45. Regards,
  46.  
  47.  
  48. Paul Thomson
  49.  
  50.  
  51.  
  52.  
  53.  
  54.